<title>Confirm</title> 
<body> 
 <form> 
 <input type="button" onClick="testConfirm()" value="关闭窗口"> 
 </form> 
 <script> 
 function testConfirm() 
 { 
 var blvar; 
 blvar=confirm("你真的要关闭该窗口吗？"); 
 if (blvar) 
 window.close(); 
 else 
 window.alert("你取消了关闭窗口操作!") ; 
 } 
 </script> 
</body>
